/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package EstilosWebUI.beans;

import org.richfaces.component.UITree;
import org.richfaces.component.state.TreeStateAdvisor;
import org.richfaces.model.TreeRowKey;

/**
 *
 * @author Emmanuel
 */
public class TreeDemoStateAdvisor implements TreeStateAdvisor{
 public Boolean adviseNodeOpened(UITree tree) {
        if (!PostbackPhaseListener.isPostback()) {
            Object key = tree.getRowKey();
            TreeRowKey treeRowKey = (TreeRowKey) key;
            if (treeRowKey == null || treeRowKey.depth() <= 2) {
                return Boolean.TRUE;
            }
        }

        return null;
    }

    public Boolean adviseNodeSelected(UITree tree) {
        return null;
    }

}
